package com.hou.mytomcat.util;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 对于非阻塞的IO，只要将线程池设置成CPU核心数即可，此处也可以进行调试线程池参数
 */
public class ThreadPoolUtil {

    private static final ThreadPoolExecutor threadPool = new ThreadPoolExecutor(4, 4, 100,
            TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());

    public static void run(Runnable r) {
        threadPool.execute(r);
    }
}
